<cfset BASE = CreateObject("component", "#session.rootDir#.cfc.base") />

<cfoutput>
	<!---HTML header, css links, js links, and page title--->
    #BASE.htmlHeaderNonSCF(
    	"", <!---JS links--->
        "", <!---CSS links--->
        "Clean Up GUID for ANMC/SCF double dippers", <!---Page Title--->
        "Status", <!---Active Nav Link--->
        "true" <!---Alternate menu.  Shows main EPAR links--->
    )#
    <!---HTML header, css links, js links, and page title--->


<cfobject type="dotnet" name="objQuery" class="ADTools.Query" assembly ="C:\Program Files\Southcentral Foundation\ADTools\ADTools.dll">   
	
<cfquery name="qryGetDbls" datasource="#Session.DataSourceRosettaStone#">
	Select * from RosettaStone
	where AD_GUID is null and useraccount is not null and disabled = 0
</cfquery>

<!---cfdump var="#qryGetDbls#"--->

	<cfloop query="qryGetDbls">
		<cfset strGUID = "">
		<cfset intRosettaID = RosettaID>
		
		<cfif Left(UserAccount, 4) EQ 'ANMC'>
			<cfset strUserID = right(UserAccount, len(UserAccount)-4)>		
			<cfset strGUID = objQuery.GetGUID("", "#strUserID#@anmc.org", "10.100.1.101")> 
		<cfelse>
			<cfset strUserID = UserAccount>
			<cfset strGUID = objQuery.GetGUID("#strUserID#", "", "")> 
		</cfif>		
		#strUserID# 
		<cfif isdefined("strGUID") and strGUID NEQ "">			
			#strGUID#
			<!--- UPDATE --->
			<cfquery name="qryUpdateGUID" datasource="#Session.DataSourceRosettaStone#">
				scf_UpdateGUID '#strGUID#', #intRosettaID#
			</cfquery>
		<cfelse>
			<!--- DISABLE --->
			<cfquery name="qryDisableGUID" datasource="#Session.DataSourceRosettaStone#">
				scf_DisableRosettaUser #intRosettaID#
			</cfquery>
		</cfif><BR />
	</cfloop>
	


    <!---HTML footer, closes html and body tags.  Any footer info goes here--->
    #BASE.htmlFooterNonSCF()#
    <!---HTML footer, closes html and body tags.  Any footer info goes here--->
</cfoutput>
